﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Collections;

namespace Windvoice.Library
{
    public class EnumHelper
    {
        public static IEnumerable<SelectListItem> ToSelectSource(Type enumType)
        {
            List<SelectListItem> list = new List<SelectListItem>();

            foreach (object code in Enum.GetValues(enumType))
                list.Add(new SelectListItem() { Text = Enum.GetName(enumType, code), Value = ((int)Enum.Parse(enumType,code.ToString())).ToString() });

            return list;
        }

        public static ArrayList GetIntArray(int start = 0, int end = 9)
        {
            ArrayList al = new ArrayList();
            for (int i = start; i < end; i++)
                al.Add(i);

            return al;
        }
    }
}
